<?php
namespace App\Mp\Controllers;

use App\Mp\Controllers\Mp;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;

class PermissionController extends Mp{

	public function __construct(Request $request)
    {   parent::__construct($request);
        $this->middleware('auth');
    }
	//权限列表
	public function index(){
		$this->_init('权限管理');
		$this->_makeNav(['title'=> '权限管理']);
		$permissions = Permission::where('guard_name','admin')->get();
		$this->_addData('permissions',$permissions);
		return $this->_displayWithLayout('Mp::permission.permission');
	}

	//角色列表
	public function roles(){
		$this->_init('权限管理');
		$this->_makeNav(['title'=> '角色管理']);
		$roles = Role::where('guard_name','admin')->get();
		$this->_addData('roles',$roles);
		return $this->_displayWithLayout('Mp::permission.role');
	}
}